<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('我的报修记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>单车ID：</label>
                                <input type="text" name="bikId"/>
                            </li>
                            <li>
                                <label>单车名称：</label>
                                <input type="text" name="bikBicycle.name"/>
                            </li>
                            <li>
                                <label>报修状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="1">未解决</option>
                                    <option value="2">已解决</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <h3>我提交的报修记录</h3>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('admin:repair:edit')}]];
        var removeFlag = [[${@permission.hasPermi('admin:repair:remove')}]];
        var prefix = ctx + "admin/repair";

        $(function() {
            var options = {
                url: prefix + "/myList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "报修记录",
                detailView: true,
                detailFormatter: detailFormatter,
                columns: [
                {
                    field: 'repId',
                    title: '报修记录唯一标识',
                    visible: false
                },
                {
                    field: 'bikId',
                    title: '单车ID'
                },
                    {
                        field: 'bikBicycle.name',
                        title: '单车名称',
                        formatter: function(value, row, index) {
                            return '<strong>'+ row.bikBicycle.name +'</strong>';
                        }
                    },
                {
                    field: 'status',
                    title: '报修状态',
                    formatter: function (value, row, index) {
                        if (row.status == 1) {
                            return '<strong>未解决</strong>';
                        } else if (row.status == 2) {
                            return '<strong>已解决</strong>';
                        }
                    },
                    cellStyle: function (value, row, index) {
                        if (row.status == 1) {
                            return {
                                css: {
                                    'color': '#d00303'
                                }
                            };
                        } else if (row.status == 2) {
                            return {
                                css: {
                                    'color': '#008018'
                                }
                            };
                        }
                    }
                },
                {
                    field: 'subTime',
                    title: '提交时间'
                }]
            };
            $.table.init(options);
        });

        //报修信息详情
        function detailFormatter(index, row) {
            let html = [];
            html.push('<p><b>内容描述: </b> '+ row.content);
            return html.join('');
        }
    </script>
</body>
</html>